package com.zsr.chapter04.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author zsr
 * @Description
 * @Date 2021/4/21 23:23
 */
public class UserServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        //定义变量并输出
        String username="张三";
        response.getWriter().print("用户名为："+username+"<br/>");
        //请求包含
        request.getRequestDispatcher("/orderServlet").include(request,response);
    }
}
